#include <stdlib.h>
#include <mpi.h>

#define PULL 0
#define DELETE 1
#define PUSH 2

struct operation_message {
  int operation; // 0 - pull, 1 - remove, 2 - push
  int content;
  int server;
};

typedef struct operation_message operation_message;

struct operation_node {
  operation_message message;
  struct operation_node *next;
};

typedef struct operation_node operation_node;

struct operation_list {
  operation_node *head;
  int size;
};

typedef struct operation_list operation_list;

void init_operation_list(operation_list *list);

int insert_operation(operation_list *list, operation_message msg);

int delete_operation(operation_list *list);

operation_message get_operation(operation_list list);

void build_operation_datatype(operation_message *msg, MPI_Datatype *msg_type_ptr);
